There are two types of Xposome applications that you can install on your local machine:
In this post, I will only go over instructions of how to install Xposome without GeneHive on your local machine. If you are interested in incorporating GeneHive as a database, please contact us for further implementation.
Must have R and Rstudio installed before proceeding:
To run Xposome application locally:
Not familiar with Docker? You can download it here and check out the R Docker tutorials.
To dockerize the Xposome application:
The docker image for Xposome is also available at Docker Hub. To pull the image, just type the following command in the terminal:
Additionally, check out how you can configure your web applications with HTTPS traffics with NGINX and Docker-Compose
The Xposome application requires several structural datasets in order for it to run smoothly. We provide API access to our data, see API Explorer.
There are two main parts of the Xposome application:
Contains a list of projects or chemical screenings that were exposed to high-throughput transcriptomics assays. Each screen provides annotation about the chemicals and cell-line samples that were used in the experiment. A detailed analysis was also done to explore gene expression set, gene set enrichment, and gene connectivity that was exposed to a panel of known carcinogens.
Below is a screenshot of our home page and a snapshot of the Adipogenicity project:
Requires access from authorized users. This restricted page only allows certain users to make changes to the existed screens or to upload new screens onto the Project Page.
The default login credentials are set as:
Username: Xposome
Password: Xposome
Lastly, check out the documentation of how to reset password if users forgot their login credentials using Send Emails with Postfix.
Developed by Reina Chau, Stefano Monti.
Site built with flexdashboard 0.5.2
NGINX - An open source web server and reverse proxy technology used for hosting websites and applications
Docker-Compose - A technology for enabling docker containers to communicate to each other
In this post, I will go over steps of how to create an encrypt (https) traffic that allows users to interact with the Xposome application that is published through a docker container. To achieve that, we need both NGINX and docker-compose.
Here are seven steps to set-up NGINX and docker-compose:
Check out how to install Docker-compose here
To check if docker-compose is installed,
docker-compose --version
An image for NGINX can be found at Docker Hub. You can pull this image without the need of installing the NGINX software locally.
docker pull nginx:latest
To check if the image is built successfully
docker images
Also see this link on how to use the NGINX image
You can check out this step on my previous post here for more details
Once the images for NGINX and Xposome application are build successfully, we can start setting up the NGINX configuration files. There are two configuration files for NGINX, nginx.conf and default.conf.template files.
The nginx.conf file contains the standard configuration for NGINX. Unless you know how to add directives to a configuration file, otherwise, I do not recommend making any changes to this file.
For example, one of the directives that we used on our web portal is to maximize a file uploading size from our users. This directive is useful as it helped us avoided the problems of importing some gene expression datasets that far exceeded the limit of 1MB file uploads on NGINX.
The default.conf.template file contains HTTP configuration that allows NGINX to direct any encrypt (https) or unencrypt (http) traffics to an application that is published on a specified port on the host machine.
How NGINX talks to Docker
With NGINX,
nginx → listens on → port 80 (http) and 443 (https)
With Docker,
Docker → listens on → port 80/443/8080/3838/8000/…
With SHINY
Shiny → listens on localhost → port 3838/8787/4848/…
In other words, when we run a docker container, we basically expose our application through a port that is viewable on a Shiny's localhost (for example: port 3838). Docker listens to this port and reroutes the application to a specified port on the host machine (for example: port 7856). Therefore, when we navigate to port 7856 on the host domain (for example http://[domain_name/ip address]:7856), we will see that the shiny app is hosted there.
Nevertheless, we probably do not want to direct our users to an application through a port link. Thus, we can use NGINX configuration files to create an alias location for the application (for example https://[domain_name/ip address]/Xposome/). Hence, when a user is navigated to that specified address on the host domain, NGINX will transfer that traffic to the port e.g. 7856 of where the application was originally published on. Furthermore, NGINX will encrypt that traffic with a https protocol. As a result, NGINX is served as a reverse proxy for hosting our applications.
Here is a snapshot of how the http configuration file looks like:
Once we had configured NGINX as a reverse proxy for our application, we can create a docker-compose.yml file that comprises of all of the containers that we want to communicate with NGINX container.
To enable communication between containers, in the docker-compose file, we must create a service to run the NGINX container and a service to run the Xposome container. Under each service, we need to specify a list of instructions of how a container can be built, for instance, what image is used to build the container, what do we want to name the container, what port is used to expose the shiny app to Docker, and what port is used to publish the app on the host machine, etc.
After we had defined all of the key components of how the containers can be built, one last step is to confirm the host port on the docker-compose.yml file matches the port that NGINX redirects the encrypt traffics to the application on HTTP configuration file.
Here is a snapshot of the docker-compose.yml file:
After we had the docker-compose file and NGINX configuration files all set up, we can cd to where docker-compose.yml is located and run the following command to fire up all the containers that were defined in the docker-compose file.
docker-compose up -d
-d is used to run docker compose in detach mode
Navigate to the alias domain for the application (for example https://montilab.bu.edu/Xposome/) and see if the application is indeed hosted there.
Developed by Reina Chau, Stefano Monti.
Site built with flexdashboard 0.5.2
Postfix - A popular open-source Mail Transfer Agent (MTA) that can be used to route and deliver emails on a Linux system
Docker - A software platform that allows developers to build, test, deploy, and run applications using containers
In this post, I will go over steps of how to send emails from a docker container through Postfix installed on the host machine. In my previous posts, I went over how to dockerize the Xposome application. The Xposome application has two parts: the Project Page and the Moderator Page. In the Moderator Page, we have an option that allow users to retrieve their passwords if they forgot their login credentials. Postfix is actually used here to send a notification email to users and remind them that their password has changed.
Here are five steps to set-up Postfix and send new password to users if they forgot their login credentials:
Depending on your Operating System, for mine, I have CentOS 8 server. Therefore, I will use this documenation on how to install and configure postfix mail server on CentOS 8. You can also see this link to install and configure Postfix on Ubuntu 16.04.
See my previous post here for more details
After Postfix is installed, the main configuration files is stored at /etc/postfix/main.cf.
To configure Postfix to listen to requests from docker container, there is something called docker bridge (docker0) which acts as a bridge between the ethernet port and the docker container so that data can go back and forth. Hence, we want Postfix to listen on the docker0 interface. To do that, type ifconfig on your host system to find out the bridge address and set your Postfix to listen on it.
As you can see in the image above, the IP address is 172.17.0.1
In the Postfix configuration file (/etc/postfix/main.cf), set
inet_interfaces = 172.17.0.1
While you are there, add your actual docker container ip address to mynetworks
mynetworks = 172.17.0.5
172.17.0.5 is the private IP address of my docker container from which I use to send emails.
You can find the IP address for your docker container by
docker inspect [container_id/container_name]
Here is an email function that sends a temporary password to users who forgot their login credentials:
sendpassword <- function(from_sender="montilab@bu.edu", to_recipient="montilab@bu.edu", recipient_first="Montilab", recipient_last="Montilab", recipient_account="Montilab", tmp_pwd){
recipient=paste(recipient_first, recipient_last)
msg <- mime_part(
paste0(
'<!DOCTYPE>',
'<html>',
'<head>',
'<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>',
'<meta name="viewport" content="width=device-width, initial-scale=1.0"/>',
'<title>HTML MESSAGE</title>',
'<style type="text/css">',
'</style>',
'</head>',
'<body>',
'<p>Hi <strong>', recipient_first, ',</strong></p>',
'<p>The password for your Xposome account has changed.</p>',
'<p></p>',
'<p>Username: <strong>', recipient_account, '</strong></p>',
'<p>Temporary password: <strong>', tmp_pwd, '</strong></p>',
'<br>',
'<p>Log back in? Follow this link, <strong>https://montilab.bu.edu/Xposome/?page=sign_in</strong></p>',
'<br>',
'<p>Best,</p>',
'<p>Montilab Team</p>',
'</body>',
'</html>'
)
)
## Override content type.
msg[["headers"]][["Content-Type"]] <- "text/html"
from <- paste0("\"Montilab Team\"<", from_sender, ">")
to <- paste0("\"", recipient, "\"<", to_recipient, ">", collapse="")
subject <- "Temporary password for Xposome"
body <- list(msg)
sendmail(from, to, subject, body, control=list(smtpServer="smtp.bu.edu", smtpPort="25"))
}
On the Xposome application, there is a sign in page. When a user clicks on the forgot password? link, a modal dialog will pop up. After he/she provided the user account information and click the submit button, a new temporary password will be send to his/her email.
Here a snapshoot of the Xposome interface:
if you are using the same email format that I have structured above, you should receive an email similar to this one.
Developed by Reina Chau, Stefano Monti.
Site built with flexdashboard 0.5.2
The API Explorer provides documentation on how users can retrieve data from the Xposome application and create their next project. All successful responses are returned in JSON. Only queries that respond with a 200 response code is considered successful.
Here are standard HTTP codes you will find in the “Status” element of the response body.
| Status Code | Description |
| 200 OK | Standard HTTP successful response |
| 404 Bad Request or Source Not Found | Standard HTTP invalid request response |
| 500 Internal Server Error | There was an unexpected error on our server. If you see this error, please help us notify the issue on our GitHub page |
There are four data sources that are currently returned from the API.
| Data | Description | Return |
| Projects | a list of projects in the GeneHive Database. Visit our webpage to see on how we define each project | list |
| Datasets | a list of data sources for generating the Xposome portal such as profile and chemical annotation, expression set, gene set enrichment, connectivity set, and K2-taxonomer | data frame or RDS file |
| RDS Bundle | a bundle of RDS files for a given Xposome projects, including profile annotation, chemical annotation, expression set, gene set enrichment, connectivity set, and K2-taxonomer | zip file |
| Statistics | a summary statistics for a specific chemical within a particular project. The statistics are calculated based on its gene expression, gene set enrichment and gene connectivity | data frame |
Below are a list of R packages and GET requests in R to retrieve data from the Xposome projects. However, one can use Python or other programs to implement the REST API calls.
# R packages required for API calls
library(K2Taxonomer)
library(Biobase)
library(jsonlite)
library(httr)
| /projects | Return a list of projects available in the GeneHive database |
| /profile_annotation | Return the profile annotation of a specific project |
| /chemical_annotation | Return the chemical annotation of of a specific project |
| /expression_set | Return the gene expression dataset of a specific project |
| /enrichment_set | Return the enrichment dataset of a specific project |
| /connectivity_set | Return the connectivity dataset of a specific project |
| /k2_taxonomer | Return the K2Taxonomer dataset of a specific project |
| /rds_bundle | Return a bundle of RDS files for a given project |
| /gene_expression | Return a collection of differential expressed genes that exposed to a known toxin |
| /gs_enrichment | Return a collection of gene set enrichment that was exposed to a given drug |
| /connectivity | Return a collection of gene connectivity that are linked to exposure of a known chemical |
Additionally, we provide direct links to query contents on our website. See Links to Application.
Developed by Reina Chau, Stefano Monti.
Site built with flexdashboard 0.5.2
We provide a direct link to a specific page on our Xposome interface. This feature allows users to connect information from their web application to our website.
There are two types of queries that users can request from our web page through a web browser:
Hera are four URL tags that can be used to search our web page:
| Tag | Description |
| ?page | a url tag that searches for a specific page on the Xposome interface (e.g. an Information Page or a Project Page) |
| &tab | an additional tag that navigates to a specific tab on the project page |
| &chemical_id | an additional tag that navigates to a specific chemical id/CAS id/chemical name on the project page |
| &stat | an additional tag that navigates to a statistical tab on the project page |
Below is a snapshot of how the URL tags are defined on our web page:
URL: https://montilab.bu.edu/Xposome/?page=home
| Parameter | Value | Description | Data Type |
| page |
- home (default) - about - contact - sign_in |
a page that contains an overview about the Xposome project and how to contact us | string |
| Parameter | Value | Description | Data Type |
| page | name of a particular project in the GeneHive database (see API Explorer on how to retrieve a list of project names) |
a project page on the Xposome application | string |
| tab |
- about (default) - annotation - chemical_explorer - marker_explorer - heatmap_explorer - k2_taxanomer_results - compare_multiple |
a tab panel of a particular project. Currently, there are seven tab-panels defined for a given project. | string |
| chemical_id | see API Explorer on how to retrieve a list of chemical ids/CAS ids/chemical names of a particular project | a chemical id/CAS id/chemical name located in the chemical explorer page of a particular project | string |
| stat |
- gene_expression (default) - gene_set_enrichment - connectivity |
a statistical tab-panel located in the chemical explorer page of a particular project | string |
Developed by Reina Chau, Stefano Monti.
Site built with flexdashboard 0.5.2